﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SonCa.SocialNetwork.Web.Friends.IPresenters;
using SonCa.SocialNetwork.Web.Friends.Presenters;

namespace SonCa.SocialNetwork.Web.Friends
{
    public partial class FriendsRequest : System.Web.UI.Page, IFriendsRequestPresenter
    {
        private FriendsRequestPresenter _presenter;
        protected void Page_Load(object sender, EventArgs e)
        {
            _presenter = new FriendsRequestPresenter();
            _presenter.Init(this);
        }

        public void LoadFriendRequest(List<HelperClass.FriendRequestHelper> friendRquestHelpers,List<HelperClass.FriendRequestHelper> messages)
        {
            if (friendRquestHelpers.Count > 0)
            {
                rptFriendInvitation.DataSource = friendRquestHelpers;
                rptFriendInvitation.DataBind();
            }
            if (messages.Count > 0)
            {
                rptMessages.DataSource = messages;
                rptMessages.DataBind();
            }
            else if(friendRquestHelpers.Count <= 0 && messages.Count <= 0)
            {
                lblMes.Text = "Không có lời mời kết bạn.";
                lblMes.Visible = true;
            }
        }

    }
}